(() => {
  // 基础类型
  let flag: boolean = true
  let num: number = 110
  let str: string = '周张恒'


  //任意类型
  let any: any;
  let unknown: unknown;
  let S: string
  unknown = "zhou"
  //    S = unknown 会报错不能直接赋值
  /* 类型断言 */
  S = unknown as string
  S = <string>unknown


  // ====对象类型 ===
  let obj: {};
  obj = {}
  obj = function () { }

  /* 可以用来指定对象中拥有那些属性
    在属性名后面加上 ? 表示属性是可选的
  */
  let zhou: { name: string, age?: number }
  zhou = { name: '周张恒', age: 20 }
  // [propName: string]: any 表示任意类型的属性
  let ph: { name: string, [propName: string]: any }
  ph = { age: 18, name: "彭慧", sex: 'female' }

  // 数组类型
  let numArr: number[]
  let strArr: string[]
  let boolArr: Array<boolean>
  numArr = [12, 344, 54]
  strArr = ['asas', 'sasa']


  // 元组类型
  let h: [string, number, boolean]
  h = ['aaa', 123, false]

  // 枚举类型
  enum Gender {
    Male,
    Female
  }
  let zzh: { name: string, gender: Gender }
  zzh = { name: "zzh", gender: Gender.Male }
  console.log(zzh);

  // & |
  let f: number | string
  let ff: { age: number } & { name: string }

  // 类型的别名
  type mytype = 1 | 2 | 3
  let ab: mytype
  let ac: mytype
})()